@ GNU AS assembler header file for OSFSControl
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:49:36 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 5 Sept 1995

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@ GNU General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef OSFSControl_Hdr
#  define OSFSControl_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

#  ifndef Get_FileSwitch
#    define Get_FileSwitch
#    include "oslib/FileSwitch.Hdr"
#  endif

#  ifndef Get_OSArgs
#    define Get_OSArgs
#    include "oslib/OSArgs.Hdr"
#  endif

@Symbols for constants
#  define OSFSControl_OptRestoreDefault 0x0
#  define OSFSControl_OptMessageLevel 0x1
#  define OSFSControl_OptBootAction 0x4
#  define OSFSControl_CopyRecurse 0x1
#  define OSFSControl_CopyForce 0x2
#  define OSFSControl_CopyGivenTimes 0x4
#  define OSFSControl_CopyConfirm 0x8
#  define OSFSControl_CopyVerbose 0x10
#  define OSFSControl_CopyQuick 0x20
#  define OSFSControl_CopyPrompt 0x40
#  define OSFSControl_CopyDelete 0x80
#  define OSFSControl_CopyAllowPrint 0x100
#  define OSFSControl_CopyNoAttributes 0x200
#  define OSFSControl_CopyStamp 0x400
#  define OSFSControl_CopyStructure 0x800
#  define OSFSControl_CopyNewer 0x1000
#  define OSFSControl_CopyGivenDescriptor 0x2000
#  define OSFSControl_CopyLook 0x4000
#  define OSFSControl_WipeRecurse 0x1
#  define OSFSControl_WipeForce 0x2
#  define OSFSControl_WipeGivenTimes 0x4
#  define OSFSControl_WipeConfirm 0x8
#  define OSFSControl_WipeVerbose 0x10
#  define OSFSControl_WipeAllowPrint 0x100
#  define OSFSControl_CountRecurse 0x1
#  define OSFSControl_CountGivenTimes 0x4
#  define OSFSControl_CountConfirm 0x8
#  define OSFSControl_CountVerbose 0x10
#  define OSFSControl_CountAllowPrint 0x100
#  define OSFSControl_KindFree 0x0
#  define OSFSControl_KindAllocated 0x1
#  define OSFSControl_KindFound 0x2
#  define OSFSControl_KindSharable 0x3
#  define OSFSControl_DirCSD 0x0
#  define OSFSControl_DirPSD 0x1
#  define OSFSControl_DirURD 0x2
#  define OSFSControl_DirLib 0x3

@Symbols for structure offsets and sizes
@ abstract type
#  define OSFSControl_Id 4

        .struct 0
OSFSControl_FSInfoBlock_name_offset: .skip   Int
OSFSControl_FSInfoBlock_banner_offset: .skip   Int
OSFSControl_FSInfoBlock_open_offset: .skip   Int
OSFSControl_FSInfoBlock_get_bytes: .skip   Int
OSFSControl_FSInfoBlock_put_bytes: .skip   Int
OSFSControl_FSInfoBlock_args_offset: .skip   Int
OSFSControl_FSInfoBlock_close_offset: .skip   Int
OSFSControl_FSInfoBlock_file_offset: .skip   Int
OSFSControl_FSInfoBlock_info   : .skip   FileSwitch_FSInfo
OSFSControl_FSInfoBlock_func_offset: .skip   Int
OSFSControl_FSInfoBlock_gbpb_offset: .skip   Int
OSFSControl_FSInfoBlock_extra_info: .skip   FileSwitch_FSExtraInfo
OSFSControl_FSInfoBlock        : 

        .struct 0
        .skip   Bits
OSFSControl_CopyFlags          : 

        .struct 0
OSFSControl_Descriptor_addr    : .skip   Ptr
OSFSControl_Descriptor_size    : .skip   Int
OSFSControl_Descriptor         : 

        .struct 0
        .skip   Bits
OSFSControl_WipeFlags          : 

        .struct 0
        .skip   Bits
OSFSControl_CountFlags         : 

        .struct 0
        .skip   Int
OSFSControl_ObjectKind         : 

        .struct 0
        .skip   Int
OSFSControl_SpecialDir         : 


@Symbols for SWI's and SWI reason codes
.set XOS_FSControl,0x20029
.set OS_FSControl,0x29

#  define OSFSControl_Dir 0x0
   @Entry
   @  R0 = &0
   @  R1 -> dir_names (String)

#  define OSFSControl_Lib 0x1
   @Entry
   @  R0 = &1
   @  R1 -> dir_names (String)

#  define OSFSControl_StartApplication 0x2
   @Entry
   @  R0 = &2
   @  R1 -> tail (String)
   @  R2 = cao (pointer to data)
   @  R3 -> command (String)

#  define OSFSControl_Run 0x4
   @Entry
   @  R0 = &4
   @  R1 -> file_names (String)

#  define OSFSControl_Cat 0x5
   @Entry
   @  R0 = &5
   @  R1 -> dir_names (String)

#  define OSFSControl_Ex 0x6
   @Entry
   @  R0 = &6
   @  R1 -> dir_names (String)

#  define OSFSControl_LCat 0x7
   @Entry
   @  R0 = &7
   @  R1 -> dir_names (String)

#  define OSFSControl_LEx 0x8
   @Entry
   @  R0 = &8
   @  R1 -> dir_names (String)

#  define OSFSControl_Info 0x9
   @Entry
   @  R0 = &9
   @  R1 -> file_names (String)

#  define OSFSControl_Opt 0xa
   @Entry
   @  R0 = &A
   @  R1 = opt (Int)
   @  R2 = value (Int)

#  define OSFSControl_SetTemporaryFS 0xb
   @Entry
   @  R0 = &B
   @  R1 -> file_name (String)
   @Exit
   @  R1 -> file_name_out (String)
   @  R2 = old_fs_no (FileSwitch_FSNo)
   @  R3 -> special (String)

#  define OSFSControl_AddFS 0xc
   @Entry
   @  R0 = &C
   @  R1 -> module (data)
   @  R2 = fs_info_offset (Int)
   @  R3 = workspace (pointer to Void)

#  define OSFSControl_LookupFS 0xd
   @Entry
   @  R0 = &D
   @  R1 = fs_no_or_name (OSFSControl_Id)
   @  R2 = control_terminated (Bool)
   @Exit
   @  R1 = fs_no_out (FileSwitch_FSNo)
   @  R2 = fs_found (Bool)

#  define OSFSControl_SelectFS 0xe
   @Entry
   @  R0 = &E
   @  R1 = fs_no_or_name (OSFSControl_Id)

#  define OSFSControl_BootFromFS 0xf
   @Entry
   @  R0 = &F

#  define OSFSControl_RemoveFS 0x10
   @Entry
   @  R0 = &10
   @  R1 -> fs_name (String)

#  define OSFSControl_AddSecondaryFS 0x11
   @Entry
   @  R0 = &11
   @  R1 -> fs_name (String)
   @  R2 -> secondary_name (String)
   @  R3 = workspace (pointer to Void)

#  define OSFSControl_ReadFileType 0x12
   @Entry
   @  R0 = &12
   @  R2 = file_type (Bits)
   @Exit
   @  R2 = name1 (Bits)
   @  R3 = name2 (Bits)

#  define OSFSControl_RestoreCurrent 0x13
   @Entry
   @  R0 = &13

#  define OSFSControl_ReadModuleBase 0x14
   @Entry
   @  R0 = &14
   @Exit
   @  R1 -> module (data)
   @  R2 = workspace (pointer to Void)

#  define OSFSControl_ReadFSHandle 0x15
   @Entry
   @  R0 = &15
   @  R1 = file (OS_F)
   @Exit
   @  R1 = fs_handle (Int)
   @  R2 = info_word (Int)

#  define OSFSControl_ReadFSHandleW 0x15
   @Entry
   @  R0 = &15
   @  R1 = file (OS_FW)
   @Exit
   @  R1 = fs_handle (Int)
   @  R2 = info_word (Int)

#  define OSFSControl_Shut 0x16
   @Entry
   @  R0 = &16

#  define OSFSControl_Shutdown 0x17
   @Entry
   @  R0 = &17

#  define OSFSControl_Access 0x18
   @Entry
   @  R0 = &18
   @  R1 -> file_names (String)
   @  R2 -> access (String)

#  define OSFSControl_Rename 0x19
   @Entry
   @  R0 = &19
   @  R1 -> file_name (String)
   @  R2 -> new_file_name (String)

#  define OSFSControl_Copy 0x1a
   @Entry
   @  R0 = &1A
   @  R1 -> from (String)
   @  R2 -> to (String)
   @  R3 = flags (OSFSControl_CopyFlags)
   @  R4 = start_load (Bits)
   @  R5 = start_exec (Bits)
   @  R6 = end_load (Bits)
   @  R7 = end_exec (Bits)
   @  R8 -> descriptor (OSFSControl_Descriptor)

#  define OSFSControl_Wipe 0x1b
   @Entry
   @  R0 = &1B
   @  R1 -> file_names (String)
   @  R3 = flags (OSFSControl_WipeFlags)
   @  R4 = start_load (Bits)
   @  R5 = start_exec (Bits)
   @  R6 = end_load (Bits)
   @  R7 = end_exec (Bits)

#  define OSFSControl_Count 0x1c
   @Entry
   @  R0 = &1C
   @  R1 -> file_names (String)
   @  R3 = flags (OSFSControl_CountFlags)
   @  R4 = start_load (Bits)
   @  R5 = start_exec (Bits)
   @  R6 = end_load (Bits)
   @  R7 = end_exec (Bits)
   @Exit
   @  R2 = byte_count (Int)
   @  R3 = file_count (Int)

#  define OSFSControl_ReadSecondaryFS 0x1e
   @Entry
   @  R0 = &1E
   @Exit
   @  R1 -> module (data)
   @  R2 = workspace (pointer to Void)

#  define OSFSControl_FileTypeFromString 0x1f
   @Entry
   @  R0 = &1F
   @  R1 -> file_type_name (String)
   @Exit
   @  R2 = file_type (Bits)

#  define OSFSControl_FileInfo 0x20
   @Entry
   @  R0 = &20
   @  R1 -> file_names (String)

#  define OSFSControl_ReadFSName 0x21
   @Entry
   @  R0 = &21
   @  R1 = fs_no (FileSwitch_FSNo)
   @  R2 = buffer (pointer to String)
   @  R3 = size (Int)

#  define OSFSControl_RegisterImageFS 0x23
   @Entry
   @  R0 = &23
   @  R1 -> module (data)
   @  R2 = fs_info_offset (Int)
   @  R3 = workspace (pointer to Void)

#  define OSFSControl_DeregisterImageFS 0x24
   @Entry
   @  R0 = &24
   @  R1 = file_type (Bits)

#  define OSFSControl_CanonicalisePath 0x25
   @Entry
   @  R0 = &25
   @  R1 -> path_name (String)
   @  R2 = buffer (pointer to String)
   @  R3 -> var (String)
   @  R4 -> path (String)
   @  R5 = size (Int)
   @Exit
   @  R5 = spare (Int)

#  define OSFSControl_InfoToFileType 0x26
   @Entry
   @  R0 = &26
   @  R1 -> file_name (String)
   @  R2 = load_addr (Bits)
   @  R3 = exec_addr (Bits)
   @  R4 = size (Int)
   @  R5 = attr (FileSwitch_Attr)
   @  R6 = obj_type (FileSwitch_ObjectType)
   @Exit
   @  R2 = file_type (Bits)

#  define OSFSControl_URD 0x27
   @Entry
   @  R0 = &27
   @  R1 -> dir_name (String)

#  define OSFSControl_Back 0x28
   @Entry
   @  R0 = &28

#  define OSFSControl_DefectList 0x29
   @Entry
   @  R0 = &29
   @  R1 -> image_name (String)
   @  R2 = buffer (pointer to data)
   @  R3 = size (Int)

#  define OSFSControl_AddDefect 0x2a
   @Entry
   @  R0 = &2A
   @  R1 -> image_name (String)
   @  R2 = offset (Int)

#  define OSFSControl_NoDir 0x2b
   @Entry
   @  R0 = &2B

#  define OSFSControl_NoURD 0x2c
   @Entry
   @  R0 = &2C

#  define OSFSControl_NoLib 0x2d
   @Entry
   @  R0 = &2D

#  define OSFSControl_UsedSpaceMap 0x2e
   @Entry
   @  R0 = &2E
   @  R1 -> image_name (String)
   @  R2 = buffer (pointer to data)
   @  R3 = size (Int)

#  define OSFSControl_ReadBootOption 0x2f
   @Entry
   @  R0 = &2F
   @  R1 -> file_name (String)
   @Exit
   @  R2 = boot_option (Int)

#  define OSFSControl_WriteBootOption 0x30
   @Entry
   @  R0 = &30
   @  R1 -> file_name (String)
   @  R2 = boot_option (Int)

#  define OSFSControl_FreeSpace 0x31
   @Entry
   @  R0 = &31
   @  R1 -> file_name (String)
   @Exit
   @  R0 = free (Int)
   @  R1 = max (Int)
   @  R2 = size (Int)

#  define OSFSControl_NameDisc 0x32
   @Entry
   @  R0 = &32
   @  R1 -> file_name (String)
   @  R2 -> disc_name (String)

#  define OSFSControl_StampImage 0x33
   @Entry
   @  R0 = &33
   @  R1 -> file_name (String)
   @  R2 = stamp_now (Bool)

#  define OSFSControl_ObjectAtOffset 0x34
   @Entry
   @  R0 = &34
   @  R1 -> file_name (String)
   @  R2 = offset (Int)
   @  R3 = buffer (pointer to String)
   @  R4 = size (Int)
   @Exit
   @  R2 = obj_kind (OSFSControl_ObjectKind)

#  define OSFSControl_SetDir 0x35
   @Entry
   @  R0 = &35
   @  R1 -> path (String)
   @  R2 = dir (OSFSControl_SpecialDir)
   @  R3 -> fs_name (String)
   @  R6 -> special (String)

#  define OSFSControl_ReadDir 0x36
   @Entry
   @  R0 = &36
   @  R1 = buffer (pointer to String)
   @  R2 = dir (OSFSControl_SpecialDir)
   @  R3 -> fs_name (String)
   @  R5 = size (Int)
   @Exit
   @  R5 = spare (Int)
   @  R6 -> special (String)

#  define OSFSControl_FreeSpace64 0x37
   @Entry
   @  R0 = &37
   @  R1 -> file_name (String)
   @Exit
   @  R0 = free_lo (Bits)
   @  R1 = free_hi (Int)
   @  R2 = max (Int)
   @  R3 = disc_size_lo (Bits)
   @  R4 = disc_size_hi (Bits)

#  define OSFSControl_DefectList64 0x38
   @Entry
   @  R0 = &38
   @  R1 -> image_name (String)
   @  R2 = buffer (pointer to data)
   @  R3 = size (Int)

#  define OSFSControl_AddDefect64 0x39
   @Entry
   @  R0 = &39
   @  R1 -> image_name (String)
   @  R2 = offset_lo (Bits)
   @  R3 = offset_hi (Int)

#  define OSFSControl_EnumFileHandles 0x3a
   @Entry
   @  R0 = &3A
   @  R1 = prev_handle (OS_F)
   @Exit
   @  R0 = status (OSArgs_StreamStatus)
   @  R1 = next_handle (OS_F)
   @  R2 = info (FileSwitch_FSInfo)

#  define OSFSControl_RunAbsoluteFile 0x3c
   @Entry
   @  R0 = &3C
   @  R1 -> filename (String)
   @  R2 -> args (String)
   @  R3 = file_length (Int)

#  define OSFSControl_RunUntypedFile 0x3d
   @Entry
   @  R0 = &3D
   @  R1 -> filename (String)
   @  R2 -> args (String)
   @  R3 = file_length (Int)
   @  R4 = load_addr (Bits)
   @  R5 = exec_addr (Bits)

#  define OSFSControl_RunTransientFile 0x3e
   @Entry
   @  R0 = &3E
   @  R1 -> filename (String)
   @  R2 -> args (String)

#  define FSCV 0xf

#  define UpCall_MediaNotPresent 0x1
   @Entry
   @  R0 = &1
   @  R1 = fs_no (FileSwitch_FSNo)
   @  R2 -> media_name (String)
   @  R3 = device_no (Int)
   @  R4 = iteration_count (Int)
   @  R5 = timeout (Int)
   @  R6 -> media_type (String)
   @Exit
   @  R0 = changed (Int)

#  define UpCall_MediaNotKnown 0x2
   @Entry
   @  R0 = &2
   @  R1 = fs_no (FileSwitch_FSNo)
   @  R2 -> media_name (String)
   @  R3 = device_no (Int)
   @  R4 = iteration_count (Int)
   @  R5 = timeout (Int)
   @  R6 -> media_type (String)
   @Exit
   @  R0 = changed (Int)

#  define UpCallFSControl_SetArgsSize 0x200
   @Entry
   @  R0 = &3
   @  R1 = f (OS_F)
   @  R2 = size (Int)
   @  R8 = fs_info (FileSwitch_FSInfo)
   @  R9 = &200

#  define UpCallFSControl_SetArgsSizeW 0x200
   @Entry
   @  R0 = &3
   @  R1 = f (OS_FW)
   @  R2 = size (Int)
   @  R8 = fs_info (FileSwitch_FSInfo)
   @  R9 = &200

#  define UpCallFSControl_Rename 0x208
   @Entry
   @  R0 = &3
   @  R1 -> file_name (String)
   @  R2 -> new_file_name (String)
   @  R6 -> special (String)
   @  R7 -> new_special (String)
   @  R8 = fs_info (FileSwitch_FSInfo)
   @  R9 = &208

#  define UpCallFSControl_SetAttrString 0x209
   @Entry
   @  R0 = &3
   @  R1 -> file_name (String)
   @  R2 -> attr (String)
   @  R6 -> special (String)
   @  R8 = fs_info (FileSwitch_FSInfo)
   @  R9 = &209

#  define UpCall_MediaSearchEnd 0x4
   @Entry
   @  R0 = &4

#  define UpCall_NewApplication 0x100
   @Entry
   @  R0 = &100
   @  R2 = cao (pointer to data)
   @Exit
   @  R0 = started (Bool)

#endif
